/* eslint-disable @typescript-eslint/no-explicit-any */
// import { AxiosPromise } from 'axios'
import service from '@/libs/service'
let mapBaseUrl = ''
// if (window.location.href.startsWith('http')) {
  // mapBaseUrl = 'http://enncdn.oss-cn-beijing.aliyuncs.com'
// } else {
//   mapBaseUrl = 'https://enncdn.oss-cn-beijing.aliyuncs.com'
// }
mapBaseUrl = 'https://electronicmap.oss-cn-beijing.aliyuncs.com'
// mapBaseUrl = 'http://enncdn.oss-cn-beijing.aliyuncs.com'
// 获取省级地图
export function getProvince(data: any) {
  return service({
    method: 'get',
    url: `${mapBaseUrl}/geometryProvince/${data}.json`
  })
}
// 获取下钻
export function getCity(data: any) {
  return service({
    method: 'get',
    url: `${mapBaseUrl}/geometryCountries/${data}.json`
  })
}

export function getChinaMap() {
  return service({
    method: 'get',
    url: `${mapBaseUrl}/china2.json`
  })
}

// 获取活跃人数 school_id
export function getOnlineDataApi(
  type: number,
  province?: number,
  city?: number,
  area?: number,
  school_id?: number
) {
  return service({
    method: 'get',
    url: '/api/online/list',
    params: {
      type,
      province,
      city,
      area,
      school_id
    }
  })
}

// 获取统计数据  id
export function getStatisticsListApi(
  type: number,
  province?: number,
  city?: number,
  area?: number,
  school_id?: number
) {
  return service({
    method: 'get',
    url: '/api/statistics/list',
    params: {
      type,
      province,
      city,
      area,
      school_id
    }
  })
}

// 获取修改标题
export function getAndUpdateTitleApi(title?: string) {
  return service({
    method: 'get',
    url: '/api/statistics/editWord',
    params: {
      title
    }
  })
}

// 登录
export function loginApi(form: any) {
  return service({
    method: 'get',
    url: '/api/login',
    params: form
  })
}

// 登录
export function mapAll(form: any) {
  return service({
    method: 'get',
    url: '/api/wholeRegion/list',
    params: form
  })
}
// 获取总人数
export function getnumberPeople(form: any) {
  return service({
    method: 'get',
    url: '/api/statistics/getTotal',
    params: form
  })
}
